<template>
  <!--  时间不含日期-->
  <el-time-picker
    v-if="config.viewTypeValue=='5'"
    style="width: 100%"
    value-format="HH:mm"
    format="HH:mm"
    v-model="localValue"
    :disabled="config.disabled||false"
    :placeholder="config.placeholder || '任意时间点'">
  </el-time-picker>

  <!--  日期时间-->
  <el-date-picker
    v-else-if="config.viewTypeValue=='10'"
    style="width: 100%"
    v-model="localValue"
    value-format="yyyy-MM-dd"
    type="date"
    placeholder="选择日期" >
  </el-date-picker>


  <!--  日期-->
  <el-date-picker
    v-else-if="config.viewTypeValue=='9'"
    style="width: 100%"
    v-model="localValue"
    :disabled="config.disabled||false"
    type="datetime"
    value-format="yyyy-MM-dd HH:mm"
    placeholder="选择日期时间" >
  </el-date-picker>
</template>

<script>
export default {
  name: "config-date",
  props: {
    value: String,
    config: {
      type: Object,
      default: {}
    },
  },
  computed: {
    localValue: {
      get() {
        return this.value;
      },
      set(newValue) {
        this.$emit('updateValue', newValue);
      }
    }
  },
  data(){
    return{

    }
  },
  methods: {
    // updateValue(value) {
    //   this.$emit('updateValue', value);
    // }
  }
}
</script>

<style scoped>

</style>
